//
//  UIView+LSCore.m
//  ImageTool
//
//  Created by Apple on 2017/6/7.
//  Copyright © 2017年 Apple. All rights reserved.
//

#import "UIView+LSCore.h"


@implementation UIView (LSCore)



/**
 设置部分圆角 绝对布局

 @param corners 需要设置为圆角的角 UIRectCornerTopLeft|UIRectCornerTopRight
 @param radii 需要设置的圆角大小 CGSizeMake(5.0, 5.0)
 */
- (void)addRoundedCorners:(UIRectCorner)corners withRadii:(CGSize)radii
{
    
    UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:radii];
    CAShapeLayer *shape = [[CAShapeLayer alloc] init];
    [shape setPath:rounded.CGPath];
    self.layer.mask = shape;
    
}


/**
 设置部分圆角 相对布局

 @param corners 需要设置为圆角的角 UIRectCornerTopLeft|UIRectCornerTopRight

 @param radii 需要设置的圆角大小 CGSizeMake(5.0, 5.0)
 @param rect 需要设置的圆角view的rect
 */
- (void)addRoundedCorners:(UIRectCorner)corners withRadii:(CGSize)radii viewRect:(CGRect)rect
{
    UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:radii];
    CAShapeLayer *shape = [[CAShapeLayer alloc] init];
    [shape setPath:rounded.CGPath];
    self.layer.mask = shape;
    
}





@end

